import 'package:happy_elf_app/utils/request.dart';

class Home {
  Map home = {
    'getType': '/app/target-type/list', // 获取目标类型
    'getContent': '/app/target-type/content', // 获取目标内容
    'changContent': '/app/target-type/content', // 修改目标内容
    'aiContent': '/app/ai/chat', // ai聊天
    'getLottery': '/app/lottery', // 抽签
    'submitTarget': '/app/target', // 确定目标
    'getAiTask': '/app/task', // 获取ai拆分好的任务
    'optimizeStep': '/app/task/step/optimize', // 优化步骤
    'optimizePreview': '/app/target/optimize/preview', // 优化全局步骤
    'updateTask': '/app/task/updateTask', // 手动编辑任务
    'updateStep': '/app/task/step/update', // 手动编辑步骤,
    'subOptimize': '/app/target/optimize/applyOptimize', // 提交任务拆分
    'getTarget': '/app/target/list', // 获取目标列表
    'needRemind': '/app/target/emotion/needRemind', // 是否需要提醒提交情绪报告
    'overStep': '/app/task/step/finish', // 完成步骤
    'giveStep': '/app/task/step/giveUp', // 放弃步骤
    'subReport': '/app/emotion-report', // 提交情绪报告
    'getReportList': '/app/emotion-report/list', // 获取情绪报告列表
    'genius': '/app/target/genius/generate', // 生成精灵蛋
    'setGeniusName': '/app/genius/generate', // 精灵蛋名字
    'getReport': '/app/emotion-report/summary', // 获取指定目标情绪总结
    'getgiveUp': '/app/step/giveUp/list', // 获取已放弃的目标步骤
    'reviewOptimize': '/app/step/optimize', // 优化步骤
  };

  Request request = Request();

  Future<dynamic> getType() async {
    var res = await request.http(method: 'GET', api: home['getType']);
    return res;
  }

  Future<dynamic> getTypeContent(id) async {
    var res =
        await request.http(method: 'GET', api: '${home['getContent']}/$id');
    return res;
  }

  Future<dynamic> changeContent(data) async {
    var res = await request.http(
        method: 'PUT',
        api: '${home['changContent']}/${data['id']}',
        data: data);
    return res;
  }

  Future<dynamic> aiContent(data) async {
    var res =
        await request.http(method: 'PUT', api: home['aiContent'], data: data);
    return res;
  }

  Future<dynamic> getLottery() async {
    var res = await request.http(method: 'GET', api: home['getLottery']);
    return res;
  }

  Future<dynamic> submitTarget(data) async {
    var res = await request.http(
        method: 'POST', api: home['submitTarget'], data: data);
    return res;
  }

  Future<dynamic> getAiTask(id) async {
    var res =
        await request.http(method: 'GET', api: '${home['getAiTask']}/$id');
    return res;
  }

  Future<dynamic> optimizeStep(data) async {
    var res = await request.http(
        method: 'POST', api: home['optimizeStep'], data: data);
    return res;
  }

  Future<dynamic> optimizePreview(data) async {
    var res = await request.http(
        method: 'POST', api: home['optimizePreview'], data: data);

    return res;
  }

  Future<dynamic> updateTask(data) async {
    var res =
        await request.http(method: 'POST', api: home['updateTask'], data: data);
    return res;
  }

  Future<dynamic> updateStep(data) async {
    var res =
        await request.http(method: 'POST', api: home['updateStep'], data: data);

    return res;
  }

  Future<dynamic> subOptimize(data) async {
    var res = await request.http(
        method: 'POST', api: home['subOptimize'], data: data);

    return res;
  }

  Future<dynamic> getTarget() async {
    var res = await request.http(method: 'GET', api: home['getTarget']);
    return res;
  }

  Future<dynamic> needRemind(id) async {
    var res =
        await request.http(method: 'GET', api: '${home['needRemind']}/$id');
    return res;
  }

  Future<dynamic> overStep(data) async {
    var res =
        await request.http(method: 'POST', api: home['overStep'], data: data);
    return res;
  }

  Future<dynamic> giveStep(data) async {
    var res = await request.http(
        method: 'POST', api: '${home['giveStep']}', data: data);
    return res;
  }

  Future<dynamic> subReport(data) async {
    var res =
        await request.http(method: 'POST', api: home['subReport'], data: data);
    return res;
  }

  Future<dynamic> getReportList(id) async {
    var res =
        await request.http(method: 'GET', api: '${home['getReportList']}/$id');
    return res;
  }

  Future<dynamic> generateGenius(id) async {
    var res = await request.http(method: 'POST', api: '${home['genius']}/$id');
    return res;
  }

  Future<dynamic> setGeniusName(data) async {
    var res = await request.http(
        method: 'POST', api: '${home['setGeniusName']}', data: data);
    return res;
  }

  Future<dynamic> getElfData(id) async {
    var res = await request.http(
        method: 'GET', api: '/app/genius/$id/evolution/status');
    return res;
  }

  Future<dynamic> changePregress(id) async {
    var res = await request.http(
        method: 'POST', api: '/app/genius/$id/evolution/upgrade');
    return res;
  }

  Future<dynamic> getReport(id) async {
    var res = await request.http(
        method: 'GET', api: '${home['getReport']}/$id');
    return res;
  }

  Future<dynamic> getgiveUp(id) async {
    var res = await request.http(
        method: 'GET', api: '${home['getgiveUp']}/$id');
    return res;
  }

  Future<dynamic> reviewOptimize(data) async {
    var res = await request.http(
        method: 'POST', api: home['reviewOptimize'], data: data);
    return res;
  }
}
